import api from '../../js/api';
Page({


    data: {
        productList: []
    },

    onLoad(options) {
        const eventChannel = this.getOpenerEventChannel();
        eventChannel.on('param', (param) => {
            console.log(param);
            api.getKuCun(param).then(res => {
                console.log(res);
                this.setData({ productList: res.data })
            })
        });
    },
    itemTap: function name(params) {
        let tapIndex = params.currentTarget.dataset.index
        let product = this.data.productList[tapIndex]
        console.log("点击第：" + tapIndex);
        console.log(product);



        wx.navigateTo({
            url: '../ProductDetail/ProductDetail',
            success: (res) => {
                res.eventChannel.emit('product', product);
            }
        })

    },


})